package com.ruoyi.web.controller.kiku;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.kiku.domain.KikuWeiboDetail;
import com.ruoyi.kiku.service.IKikuWeiboDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 小鞠微博详情Controller
 *
 * @author TT
 * @date 2025-03-03
 */
@RestController
@RequestMapping("/kiku/weiboDetail")
public class KikuWeiboDetailController extends BaseController
{
    @Autowired
    private IKikuWeiboDetailService kikuWeiboDetailService;

    /**
     * 查询小鞠微博详情列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboDetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(KikuWeiboDetail kikuWeiboDetail)
    {
        startPage();
        List<KikuWeiboDetail> list = kikuWeiboDetailService.selectKikuWeiboDetailList(kikuWeiboDetail);
        return getDataTable(list);
    }

    /**
     * 导出小鞠微博详情列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboDetail:export')")
    @Log(title = "小鞠微博详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KikuWeiboDetail kikuWeiboDetail)
    {
        List<KikuWeiboDetail> list = kikuWeiboDetailService.selectKikuWeiboDetailList(kikuWeiboDetail);
        ExcelUtil<KikuWeiboDetail> util = new ExcelUtil<KikuWeiboDetail>(KikuWeiboDetail.class);
        util.exportExcel(response, list, "小鞠微博详情数据");
    }

    /**
     * 获取小鞠微博详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboDetail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(kikuWeiboDetailService.selectKikuWeiboDetailById(id));
    }

    /**
     * 新增小鞠微博详情
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboDetail:add')")
    @Log(title = "小鞠微博详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KikuWeiboDetail kikuWeiboDetail)
    {
        return toAjax(kikuWeiboDetailService.insertKikuWeiboDetail(kikuWeiboDetail));
    }

    /**
     * 修改小鞠微博详情
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboDetail:edit')")
    @Log(title = "小鞠微博详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KikuWeiboDetail kikuWeiboDetail)
    {
        return toAjax(kikuWeiboDetailService.updateKikuWeiboDetail(kikuWeiboDetail));
    }

    /**
     * 删除小鞠微博详情
     */
    @PreAuthorize("@ss.hasPermi('kiku:weiboDetail:remove')")
    @Log(title = "小鞠微博详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kikuWeiboDetailService.deleteKikuWeiboDetailByIds(ids));
    }
}
